home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / loTeX / loTeX.app / XText.h < prev    next >
Encoding:
Text File  |  1992-04-14  |  3.0 KB  |  86 lines

  1. /*    This file is part of the XText package (version 0.8)
  2.     Mike Dixon, April 1992
  3.     
  4.     Copyright (c) 1992 Xerox Corporation.  All rights reserved.
  5.  
  6.     Use and copying of this software and preparation of derivative works based
  7.     upon this software are permitted.  This software is made available AS IS,
  8.     and Xerox Corporation makes no warranty about the software or its
  9.     performance.
  10. */
  11.  
  12. #import "XText0.h"
  13. #import "XTAction.h"
  14.  
  15. /*    XText augments XText0 with a bunch of useful methods for emacs-like
  16.     key bindings.
  17.  
  18.     All of the cursor-movement methods take a 'mode' argument, which may
  19.     be
  20.         0        just move the point to new location
  21.         1        delete to new location
  22.         2        cut to new location
  23.         3        extend selection to new location
  24.     
  25.     The methods are
  26.         goto:end:mode:        implements all movement; second argument specifies
  27.                             the other end of the selection when mode != 0
  28.         moveWord:mode:        move n words forward from point (back if n<0)
  29.         moveChar:mode:        move n chars forward from point (back if n<0)
  30.         moveLine:mode:        move n lines down from point (up if n<0)
  31.         lineBegin:            move to beginning of current line
  32.         lineEnd:            move to end of current line
  33.         docBegin:            move to beginning of document
  34.         docEnd:                move to end of document
  35.         collapseSel:        move to beginning of selection (dir<0), end of
  36.                             selection (dir>0), or active end of sel (dir=0)
  37.         transChars            transpose characters around point
  38.         openLine            insert new line after point
  39.         scroll::            scroll window n pages + m lines
  40.         scrollIfRO::        scroll window n pages + m lines if doc is
  41.                             read-only; returns nil if doc is editable
  42.         insertChar:            inserts the character associated with a key event
  43.         insertNextChar        sets nextAction so that the next key event will be
  44.                             interpreted as a character
  45.  
  46.     When there is a non-empty selection, we keep track of which end is active
  47.     (further movement commands will be relative to that end).  When we move
  48.     up or down lines, we keep track of which column we started in and try to
  49.     stick to it.  XText's instance variables are used to implement this
  50.     behavior:
  51.         posHint        the cp of the point; if this doesn't correspond to either
  52.                     end of the selection, we put the point after the selection
  53.         xHint        the column we're trying to keep the point in during
  54.                     vertical movement
  55.         xHintPos    xHint is only valid if this is the cp of the point
  56.     ("cp" == character position)
  57.  
  58.     This file also includes initbase_emacs, called by XTDispatchAction's
  59.     initBase:estream: method when base == "emacs" to set up the default
  60.     key bindings.
  61. */
  62.  
  63. @interface XText:XText0
  64. {
  65.     int posHint;
  66.     int xHint;        // note that this is in characters, not pixels
  67.     int xHintPos;
  68. }
  69. - goto:(int)pos end:(int)end mode:(int)mode;
  70. - moveWord:(int)cnt mode:(int)mode;
  71. - moveChar:(int)cnt mode:(int)mode;
  72. - moveLine:(int)cnt mode:(int)mode;
  73. - lineBegin:(int)mode;
  74. - lineEnd:(int)mode;
  75. - docBegin:(int)mode;
  76. - docEnd:(int)mode;
  77. - collapseSel:(int)dir;
  78. - transChars;
  79. - openLine;
  80. - scroll:(int)pages :(int)lines;
  81. - scrollIfRO:(int)pages :(int)lines;
  82. - insertChar:(NXEvent *)event;
  83. - insertNextChar;
  84. @end
  85.  
  86. void initbase_emacs(actionTbl actions, NXZone *zone);